package com.zenika.zentracker.hibernate.sql;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Date;
import java.sql.Ref;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;

import org.hibernate.Interceptor;

/**
 * Proxy class with the following default behavior: All calls on this proxy are redirected to the target object.
 * 
 * This class is intended to be subclassed, it's purpose is to provide a default implementation for all the
 * <tt>CallableStatement</tt> methods.
 * 
 * Only the monitored methods will be redefined in the subclass.
 * 
 * @see java.sql.CallableStatement
 * @see java.sql.PreparedStatement
 * @author Zenika
 */
public class DefaultCallableStatementProxy extends DefaultPreparedStatementProxy implements CallableStatement {

    /**
     * @param targetCS The real CallableStatement object
     * @param interceptor A Hibernate interceptor
     * @param sql The SQL query String
     */
    public DefaultCallableStatementProxy(CallableStatement targetCS, Interceptor interceptor, String sql) {
        super(targetCS, interceptor, sql);
    }

    /**
     * @return a CallableStatement, the target object.
     */
    private CallableStatement getTarget() {
        return (CallableStatement) target;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getArray(int)
     */
    public Array getArray(int i) throws SQLException {
        return getTarget().getArray(i);

    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getArray(java.lang.String)
     */
    public Array getArray(String parameterName) throws SQLException {
        return getTarget().getArray(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getBigDecimal(int)
     */
    public BigDecimal getBigDecimal(int parameterIndex) throws SQLException {
        return getTarget().getBigDecimal(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getBigDecimal(java.lang.String)
     */
    public BigDecimal getBigDecimal(String parameterName) throws SQLException {
        return getTarget().getBigDecimal(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getBigDecimal(int, int)
     */
    public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException {
        return getTarget().getBigDecimal(parameterIndex, scale);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getBlob(int)
     */
    public Blob getBlob(int i) throws SQLException {
        return getTarget().getBlob(i);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getBlob(java.lang.String)
     */
    public Blob getBlob(String parameterName) throws SQLException {
        return getTarget().getBlob(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getBoolean(int)
     */
    public boolean getBoolean(int parameterIndex) throws SQLException {
        return getTarget().getBoolean(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getBoolean(java.lang.String)
     */
    public boolean getBoolean(String parameterName) throws SQLException {
        return getTarget().getBoolean(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getByte(int)
     */
    public byte getByte(int parameterIndex) throws SQLException {
        return getTarget().getByte(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getByte(java.lang.String)
     */
    public byte getByte(String parameterName) throws SQLException {
        return getTarget().getByte(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getBytes(int)
     */
    public byte[] getBytes(int parameterIndex) throws SQLException {
        return getTarget().getBytes(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getBytes(java.lang.String)
     */
    public byte[] getBytes(String parameterName) throws SQLException {
        return getTarget().getBytes(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getClob(int)
     */
    public Clob getClob(int i) throws SQLException {
        return getTarget().getClob(i);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getClob(java.lang.String)
     */
    public Clob getClob(String parameterName) throws SQLException {
        return getTarget().getClob(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getDate(int)
     */
    public Date getDate(int parameterIndex) throws SQLException {
        return getTarget().getDate(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getDate(java.lang.String)
     */
    public Date getDate(String parameterName) throws SQLException {
        return getTarget().getDate(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getDate(int, java.util.Calendar)
     */
    public Date getDate(int parameterIndex, Calendar cal) throws SQLException {
        return getTarget().getDate(parameterIndex, cal);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getDate(java.lang.String, java.util.Calendar)
     */
    public Date getDate(String parameterName, Calendar cal) throws SQLException {
        return getTarget().getDate(parameterName, cal);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getDouble(int)
     */
    public double getDouble(int parameterIndex) throws SQLException {
        return getTarget().getDouble(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getDouble(java.lang.String)
     */
    public double getDouble(String parameterName) throws SQLException {
        return getTarget().getDouble(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getFloat(int)
     */
    public float getFloat(int parameterIndex) throws SQLException {
        return getTarget().getFloat(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getFloat(java.lang.String)
     */
    public float getFloat(String parameterName) throws SQLException {
        return getTarget().getFloat(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getInt(int)
     */
    public int getInt(int parameterIndex) throws SQLException {
        return getTarget().getInt(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getInt(java.lang.String)
     */
    public int getInt(String parameterName) throws SQLException {
        return getTarget().getInt(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getLong(int)
     */
    public long getLong(int parameterIndex) throws SQLException {
        return getTarget().getLong(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getLong(java.lang.String)
     */
    public long getLong(String parameterName) throws SQLException {
        return getTarget().getLong(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getObject(int)
     */
    public Object getObject(int parameterIndex) throws SQLException {
        return getTarget().getObject(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getObject(java.lang.String)
     */
    public Object getObject(String parameterName) throws SQLException {
        return getTarget().getObject(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getObject(int, java.util.Map)
     */
    public Object getObject(int arg0, Map arg1) throws SQLException {
        return getTarget().getObject(arg0, arg1);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getObject(java.lang.String, java.util.Map)
     */
    public Object getObject(String arg0, Map arg1) throws SQLException {
        return getTarget().getObject(arg0, arg1);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getRef(int)
     */
    public Ref getRef(int i) throws SQLException {
        return getTarget().getRef(i);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getRef(java.lang.String)
     */
    public Ref getRef(String parameterName) throws SQLException {
        return getTarget().getRef(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getShort(int)
     */
    public short getShort(int parameterIndex) throws SQLException {
        return getTarget().getShort(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getShort(java.lang.String)
     */
    public short getShort(String parameterName) throws SQLException {
        return getTarget().getShort(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getString(int)
     */
    public String getString(int parameterIndex) throws SQLException {
        return getTarget().getString(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getString(java.lang.String)
     */
    public String getString(String parameterName) throws SQLException {
        return getTarget().getString(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getTime(int)
     */
    public Time getTime(int parameterIndex) throws SQLException {
        return getTarget().getTime(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getTime(java.lang.String)
     */
    public Time getTime(String parameterName) throws SQLException {
        return getTarget().getTime(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getTime(int, java.util.Calendar)
     */
    public Time getTime(int parameterIndex, Calendar cal) throws SQLException {
        return getTarget().getTime(parameterIndex, cal);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getTime(java.lang.String, java.util.Calendar)
     */
    public Time getTime(String parameterName, Calendar cal) throws SQLException {
        return getTarget().getTime(parameterName, cal);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getTimestamp(int)
     */
    public Timestamp getTimestamp(int parameterIndex) throws SQLException {
        return getTarget().getTimestamp(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getTimestamp(java.lang.String)
     */
    public Timestamp getTimestamp(String parameterName) throws SQLException {
        return getTarget().getTimestamp(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getTimestamp(int, java.util.Calendar)
     */
    public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException {
        return getTarget().getTimestamp(parameterIndex, cal);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getTimestamp(java.lang.String, java.util.Calendar)
     */
    public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException {
        return getTarget().getTimestamp(parameterName, cal);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getURL(int)
     */
    public URL getURL(int parameterIndex) throws SQLException {
        return getTarget().getURL(parameterIndex);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#getURL(java.lang.String)
     */
    public URL getURL(String parameterName) throws SQLException {
        return getTarget().getURL(parameterName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#registerOutParameter(int, int)
     */
    public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException {
        getTarget().registerOutParameter(parameterIndex, sqlType);
    }

    public void registerOutParameter(String parameterName, int sqlType) throws SQLException {
        getTarget().registerOutParameter(parameterName, sqlType);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#registerOutParameter(int, int, int)
     */
    public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException {
        getTarget().registerOutParameter(parameterIndex, sqlType, scale);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#registerOutParameter(int, int, java.lang.String)
     */
    public void registerOutParameter(int paramIndex, int sqlType, String typeName) throws SQLException {
        getTarget().registerOutParameter(paramIndex, sqlType, typeName);

    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#registerOutParameter(java.lang.String, int, int)
     */
    public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException {
        getTarget().registerOutParameter(parameterName, sqlType, scale);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#registerOutParameter(java.lang.String, int, java.lang.String)
     */
    public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException {
        getTarget().registerOutParameter(parameterName, sqlType, typeName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setAsciiStream(java.lang.String, java.io.InputStream, int)
     */
    public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException {
        getTarget().setAsciiStream(parameterName, x, length);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setBigDecimal(java.lang.String, java.math.BigDecimal)
     */
    public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException {
        getTarget().setBigDecimal(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setBinaryStream(java.lang.String, java.io.InputStream, int)
     */
    public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException {
        getTarget().setBinaryStream(parameterName, x, length);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setBoolean(java.lang.String, boolean)
     */
    public void setBoolean(String parameterName, boolean x) throws SQLException {
        getTarget().setBoolean(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setByte(java.lang.String, byte)
     */
    public void setByte(String parameterName, byte x) throws SQLException {
        getTarget().setByte(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setBytes(java.lang.String, byte[])
     */
    public void setBytes(String parameterName, byte[] x) throws SQLException {
        getTarget().setBytes(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setCharacterStream(java.lang.String, java.io.Reader, int)
     */
    public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException {
        getTarget().setCharacterStream(parameterName, reader, length);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setDate(java.lang.String, java.sql.Date)
     */
    public void setDate(String parameterName, Date x) throws SQLException {
        getTarget().setDate(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setDate(java.lang.String, java.sql.Date, java.util.Calendar)
     */
    public void setDate(String parameterName, Date x, Calendar cal) throws SQLException {
        getTarget().setDate(parameterName, x, cal);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setDouble(java.lang.String, double)
     */
    public void setDouble(String parameterName, double x) throws SQLException {
        getTarget().setDouble(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setFloat(java.lang.String, float)
     */
    public void setFloat(String parameterName, float x) throws SQLException {
        getTarget().setFloat(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setInt(java.lang.String, int)
     */
    public void setInt(String parameterName, int x) throws SQLException {
        getTarget().setInt(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setLong(java.lang.String, long)
     */
    public void setLong(String parameterName, long x) throws SQLException {
        getTarget().setLong(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setNull(java.lang.String, int)
     */
    public void setNull(String parameterName, int sqlType) throws SQLException {
        getTarget().setNull(parameterName, sqlType);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setNull(java.lang.String, int, java.lang.String)
     */
    public void setNull(String parameterName, int sqlType, String typeName) throws SQLException {
        getTarget().setNull(parameterName, sqlType, typeName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setObject(java.lang.String, java.lang.Object)
     */
    public void setObject(String parameterName, Object x) throws SQLException {
        getTarget().setObject(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setObject(java.lang.String, java.lang.Object, int)
     */
    public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException {
        getTarget().setObject(parameterName, x, targetSqlType);

    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setObject(java.lang.String, java.lang.Object, int, int)
     */
    public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException {
        getTarget().setObject(parameterName, x, targetSqlType, scale);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setShort(java.lang.String, short)
     */
    public void setShort(String parameterName, short x) throws SQLException {
        getTarget().setShort(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setString(java.lang.String, java.lang.String)
     */
    public void setString(String parameterName, String x) throws SQLException {
        getTarget().setString(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setTime(java.lang.String, java.sql.Time)
     */
    public void setTime(String parameterName, Time x) throws SQLException {
        getTarget().setTime(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setTime(java.lang.String, java.sql.Time, java.util.Calendar)
     */
    public void setTime(String parameterName, Time x, Calendar cal) throws SQLException {
        getTarget().setTime(parameterName, x, cal);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setTimestamp(java.lang.String, java.sql.Timestamp)
     */
    public void setTimestamp(String parameterName, Timestamp x) throws SQLException {
        getTarget().setTimestamp(parameterName, x);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setTimestamp(java.lang.String, java.sql.Timestamp, java.util.Calendar)
     */
    public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException {
        getTarget().setTimestamp(parameterName, x, cal);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#setURL(java.lang.String, java.net.URL)
     */
    public void setURL(String parameterName, URL val) throws SQLException {
        getTarget().setURL(parameterName, val);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.sql.CallableStatement#wasNull()
     */
    public boolean wasNull() throws SQLException {
        return getTarget().wasNull();
    }

}
